<div class="container">
    <h1 id="pkg-overview">package utf16</h1>
    <p><code>import "unicode/utf16"</code>
    </p><p>utf16包实现了UTF-16序列的编解码。</p>
    
    
		
        
        
        
        
        
    
    <h2 id="IsSurrogate">func <a href="https://github.com/golang/go/blob/master/src/unicode/utf16/utf16.go?name=release#30" title="View Source">IsSurrogate</a> </h2>
    <pre class="funcdecl">func IsSurrogate(r <a href="builtin.htm#rune">rune</a>) <a href="builtin.htm#bool">bool</a></pre>
    <p>返回r是否可以编码为一个utf-16的代理对。</p>
    <h2 id="DecodeRune">func <a href="https://github.com/golang/go/blob/master/src/unicode/utf16/utf16.go?name=release#37" title="View Source">DecodeRune</a> </h2>
    <pre class="funcdecl">func DecodeRune(r1, r2 <a href="builtin.htm#rune">rune</a>) <a href="builtin.htm#rune">rune</a></pre>
    <p>将utf-16代理对(r1, r2)解码为unicode码值。如果代理对不合法，会返回U+FFFD。</p>
    <h2 id="Decode">func <a href="https://github.com/golang/go/blob/master/src/unicode/utf16/utf16.go?name=release#86" title="View Source">Decode</a> </h2>
    <pre class="funcdecl">func Decode(s []<a href="builtin.htm#uint16">uint16</a>) []<a href="builtin.htm#rune">rune</a></pre>
    <p>将utf-16序列解码为unicode码值序列。</p>
    <h2 id="EncodeRune">func <a href="https://github.com/golang/go/blob/master/src/unicode/utf16/utf16.go?name=release#47" title="View Source">EncodeRune</a> </h2>
    <pre class="funcdecl">func EncodeRune(r <a href="builtin.htm#rune">rune</a>) (r1, r2 <a href="builtin.htm#rune">rune</a>)</pre>
    <p>将unicode码值r编码为一个utf-16的代理对。如果不能编码，会返回(U+FFFD, U+FFFD)。</p>
    <h2 id="Encode">func <a href="https://github.com/golang/go/blob/master/src/unicode/utf16/utf16.go?name=release#56" title="View Source">Encode</a> </h2>
    <pre class="funcdecl">func Encode(s []<a href="builtin.htm#rune">rune</a>) []<a href="builtin.htm#uint16">uint16</a></pre>
    <p>将unicode码值序列编码为utf-16序列。</p>
</div>